$(function(){
	//下拉列表显示
	 $('#Shijuan').combobox({
		 url:'shijuan2',
		 valueField:'OUTID',
		 textField:'OUTNAME'
	 });
	
	 
	tables(null);
	
	$('#tt').tabs({
	    border:false,
	    onSelect:function(title){
			alert(title+' is selected');
	    }
	});

	//点击编辑按钮显示窗口
	$(".zp_anpai").click(function(){
		$("#zp_kaoshianpai").window("open"); 
		 
		$('#zp_yixiangbiao').datagrid({    
	 		//数据源地址
	 		url:'zpapxingzeng',
		    columns:[[
		    	{field:'FEBID',fixed:false,width:180,checkbox:true,title:'个人意向编号',align:'center'},
		    	{field:'RSENAME',fixed:false,width:180,title:'姓名',align:'center'},   
		    	{field:'POTZW',fixed:false,width:180,title:'个人意向',align:'center'},    
		        {field:'ZKZREM',fixed:false,width:180,title:'准考证',align:'center'},
		        {field:'FEBMINTIME',fixed:false,width:180,title:'开考时间',align:'center',
		    		formatter : function(value){
		        		var d = new Date(value);
		        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
		        		return times;
		        	}	
		        },    
		        {field:'FEBMAXTIME',fixed:false,width:180,title:'结束时间',align:'center',
		        	formatter : function(value){
		        		var d = new Date(value);
		        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
		        		return times;
		        	}	
		        },
		        {field:'JULDZ',fixed:false,width:180,title:'考试地址',align:'center'}
		    ]],
		    pagination:true,
		    pageNumber:1,
		    pageSize:5,
		    pageList:[5,10,15]
		});
 	});	
	
	
	$(".zp_bao").click(function(){
		var rows=$('#zp_yixiangbiao').datagrid('getChecked');
//			alert(rows[0]["ITTID"]);
		var outid = $("#Shijuan").val();
		for(var i=0;i<rows.length;i++){
			$.ajax({
				url:"updatekaoshianpai",
				type:"post",
				data:{"febid":rows[i]["FEBID"],"outid":outid},
				success:function(data){
					$("#zp_kaoshianpai").window("close");
					$( '#zhaopinanpai').datagrid('reload');
				}
			})
		} 
	});
	
	$(".zp_qu").click(function(){
		$("#zp_kaoshianpai").window("close"); 	
	})
});

function tables(tt){
	$('#zhaopinanpai').datagrid({    
 		//数据源地址
 		url:'zhaopinanpaichaxun',
 		queryParams:{
 			rsename:tt
		},
	    columns:[[    
	    	{field:'RSENAME',fixed:false,width:180,title:'姓名',align:'center'},    
	        {field:'POTZW',fixed:false,width:180,title:'个人意向',align:'center'},   
	        {field:'ZKZREM',fixed:false,width:180,title:'准考证',align:'center'},  
	        {field:'FEBMINTIME',fixed:false,width:180,title:'开考时间',align:'center',
	    		formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	        		return times;
	        	}	
	        },    
	        {field:'FEBMAXTIME',fixed:false,width:180,title:'结束时间',align:'center',
	        	formatter : function(value){
	        		var d = new Date(value);
	        		var times=d.getFullYear() + '-' + (d.getMonth() + 1) + '-' + d.getDate() + ' ' + d.getHours() + ':' + d.getMinutes() + ':' + d.getSeconds();
	        		return times;
	        	}	
	        },
	        {field:'FEBSC',fixed:false,width:180,title:'考试时长',align:'center'},
	        {field:'JULDZ',fixed:false,width:180,title:'考试地址',align:'center'},
	        {field:'OUTNAME',fixed:false,width:180,title:'考试试卷',align:'center'}
	    
	    ]],
	    pagination:true,
	    pageNumber:1,
	    pageSize:5,
	    pageList:[5,10,15]        
	});
}

function zhaopinsousuo(value,name){
	tables(value);
}

